<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>리스트 테스트</title>
 <style type="text/css">
 	.photos{
 		width: 300px; height: 300px;
 	}
 </style>
 <script src="../js/jquery-2.1.1.js"></script>
 <script type="text/javascript">
  
  $(document).ready(function() {
 	  goNextPage(); 
	
});
  
 function goNextPage() {
  var nextPage = $('#nextPage').val();
	
	 $('#morePhotos').on('click',function(){
		 $.ajax({
			 url: '/mamma/sanghyun/addList.action',
			 type:'post',
			 data: {currentPage:nextPage},
			 dataType:'json',
			 error: function() {
				alert("error");
			},
			 success: test2
		 });  
		
	});
}
  function test2() {
	alert("232323");
}
 /*  오류있음 고치셈
 function test(data) {
	var str = '';
	$.each(data.photoList,function(key, item){
		str += '<img class="photos" src="../photoData/';
		str += '+item.savedFile" id ="item.id';
		str += '">';
	})
	str += <br/>;
	alert(str);
	$('photoDiv').html(str);
} */

 </script>
</head>
<body><%-- 
<s:hidden value="currentPage" name="currentPage" id="currentPage"/> --%>
	<input type="hidden" value="${currentPage+1}" id="nextPage" name="currentPage">
	<div id="photoDiv">
		<s:iterator value="photoList" status="stat">
			<img  class="photos" src="../photoData/${savedFile}" id="${id}">
		</s:iterator><br/>
		<input type="button" value="더보기" id="morePhotos">
	</div>
</body>
</html>